package com.ui;

import android.annotation.SuppressLint;
import android.support.annotation.Nullable;

import com.bean.HomeArticleList;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ddd.wandemo.R;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public class TestArticleRvAdapter2 extends BaseQuickAdapter<HomeArticleList.DatasBean, BaseViewHolder> {
    public TestArticleRvAdapter2(int layoutResId, @Nullable List<HomeArticleList.DatasBean> data) {
        super(layoutResId, data);
    }

    @SuppressLint("SimpleDateFormat")
    @Override
    protected void convert(BaseViewHolder holder, HomeArticleList.DatasBean item) {
        holder.setText(R.id.tv_article_title,item.getTitle())
                .setText(R.id.tv_article_author,item.getAuthor())
                .setText(R.id.tv_article_time,new SimpleDateFormat("yyyy-MM-dd").format(new Date(item.getPublishTime())))
                .setText(R.id.tv_article_chapter,item.getChapterName());
    }
}
